var __extends =
    (this && this.__extends) ||
    (function () {
      var e = function (t, i) {
        return (e =
          Object.setPrototypeOf ||
          ({ __proto__: [] } instanceof Array &&
            function (e, t) {
              e.__proto__ = t;
            }) ||
          function (e, t) {
            for (var i in t)
              Object.prototype.hasOwnProperty.call(t, i) && (e[i] = t[i]);
          })(t, i);
      };
      return function (t, i) {
        function a() {
          this.constructor = t;
        }
        if ("function" != typeof i && null !== i)
          throw new TypeError(
            "Class extends value " + String(i) + " is not a constructor or null"
          );
        e(t, i),
          (t.prototype =
            null === i
              ? Object.create(i)
              : ((a.prototype = i.prototype), new a()));
      };
    })(),
  AXSuboardinateDetailView = (function (e) {
    function t(t) {
      var i = e.call(this) || this;
      return (
        (i.stoneListArr = []),
        (i.isOpen = !1),
        (i.onLoadJieGuFuJiangData = {
          caller: i,
          code: 1112,
          method: function (e) {
            ToastView.toastView(e.data),
              WebSocketService.send({ c: 1119, d: null }),
              i.onSubdetailActionFn();
          },
        }),
        (i.onLoadSuboardinateDetailDataFn = {
          caller: i,
          code: 1009,
          method: function (e) {
            if (0 == e.code) {
              (i.subObjJson = e.data),
                100 == i.subObjJson.lvl ||
                120 == i.subObjJson.lvl ||
                140 == i.subObjJson.lvl
                  ? (i.btn_zhuanzhi.visible = !0)
                  : (i.btn_zhuanzhi.visible = !1),
                e.data.trans > 0 && "常人" != e.data.title
                  ? ((i.btn_xiubukangxing.visible = !0),
                    (i.btn_change_career.visible = !0))
                  : ((i.btn_xiubukangxing.visible = !1),
                    (i.btn_change_career.visible = !1));
              Utils.transform(e.data.roleType, "roleType");
              (i.suboardID = e.data.id),
                (i.label_titleName.text =
                  "副将：" + e.data.name + i.dealSuboardStar(e.data.star)),
                (i.label_subTitleName.text = "ID：" + e.data.id),
                (i.label_suboard.text = Utils.dealTransAndLvl(
                  e.data.roleType,
                  e.data.lvl
                )),
                (i.image_suboardinate.skin =
                  "fujiangfull/fujiang_" + e.data.img + ".png"),
                (i.label_pinjie.text = "品阶：" + e.data.title),
                (i.label_qixue.text =
                  "气血：" + e.data.hp + "/" + e.data.maxHp),
                (i.label_jingli.text =
                  "精力：" + e.data.mp + "/" + e.data.maxMp),
                (i.label_gongji.text = "攻击：" + e.data.ap),
                (i.label_fangyu.text = "防御：" + e.data.df),
                (i.label_sudu.text = "速度：" + e.data.sp),
                (i.proepValue = e.data.p),
                (i.label_shuxingdian.text = "属性点：" + e.data.p),
                (i.label_moqiedu.text = "默契度：" + e.data.mqd),
                (i.label_zhongchengdu.text = "忠诚度：" + e.data.zcd + "/100"),
                (i.label_shengji.text = "升级：还需要 " + e.data.exp + " 经验"),
                (i.label_zhandouzhuangtai.text =
                  "战斗状态：" + i.dealSpattleAction(e.data.pos)),
                1 == e.data.sack
                  ? (i.btn_jiegufujiang.label = "解雇")
                  : (i.btn_jiegufujiang.label = "不可解雇"),
                "国士" == e.data.title
                  ? (i.btn_niubiSkill.visible = !0)
                  : (i.btn_niubiSkill.visible = !1);
              var t = parseInt(e.data.mqd);
              (i.btn_yanqing.visible = !(t > 2e5)),
                (i.skillListArr = []),
                i.initShowSkillListData(),
                (i.skillListArr = e.data.skillList);
              for (d = 0; d < i.skillListArr.length; d++)
                if (0 == d) {
                  a = i.skillListArr[d];
                  i.lable_fjjn_one.text = a.name + i.dealGradeOrHuaString(a);
                } else if (1 == d) {
                  a = i.skillListArr[d];
                  i.lable_fjjn_two.text = a.name + i.dealGradeOrHuaString(a);
                } else if (2 == d) {
                  var a = i.skillListArr[d];
                  i.lable_fjjn_three.text = a.name + i.dealGradeOrHuaString(a);
                }
              (i.armingListArr = []), (i.armingListArr = e.data.armingList);
              var n = i.suboardDict.lvl;
              i.initShowEquipmentData(n);
              for (d = 0; d < i.armingListArr.length; d++) {
                var o = i.armingListArr[d].i;
                if (1 == o) {
                  (i.lable_fjzb_one.text = i.armingListArr[d].name),
                    (i.image_fjzb_30.skin =
                      "arming/" + i.armingListArr[d].p + ".png");
                  for (
                    var l = i.armingListArr[d].s, s = "", r = 0;
                    r < l.length;
                    r++
                  ) {
                    (s += "空" == (b = l[r]) ? "" : b + ""),
                      r != l.length - 1 && (s += "\n");
                  }
                  (i.label_fjzb_30_lvl.text = s),
                    (i.label_fjzb_30_lvl.visible = !0);
                } else if (2 == o) {
                  (i.lable_fjzb_two.text = i.armingListArr[d].name),
                    (i.image_fjzb_60.skin =
                      "arming/" + i.armingListArr[d].p + ".png");
                  for (
                    var l = i.armingListArr[d].s, s = "", r = 0;
                    r < l.length;
                    r++
                  ) {
                    (s += "空" == (b = l[r]) ? "" : b + ""),
                      r != l.length - 1 && (s += "\n");
                  }
                  (i.label_fjzb_60_lvl.text = s),
                    (i.label_fjzb_60_lvl.visible = !0);
                } else if (3 == o) {
                  (i.lable_fjzb_three.text = i.armingListArr[d].name),
                    (i.image_fjzb_90.skin =
                      "arming/" + i.armingListArr[d].p + ".png");
                  for (
                    var l = i.armingListArr[d].s, s = "", r = 0;
                    r < l.length;
                    r++
                  ) {
                    var b = l[r];
                    (s += "空" == b ? "" : b + ""),
                      r != l.length - 1 && (s += "\n");
                  }
                  (i.label_fjzb_90_lvl.text = s),
                    (i.label_fjzb_90_lvl.visible = !0);
                }
              }
              if (
                ((i.stone_item1Id = ""),
                (i.stone_item2Id = ""),
                (i.stone_item3Id = ""),
                (i.label_fjtf_one.text = "魂蛋1"),
                (i.label_fjtf_two.text = "魂蛋2"),
                (i.label_fjtf_three.text = "魂蛋3"),
                e.data.stoneList && e.data.stoneList.length > 0)
              ) {
                i.stoneListArr = e.data.stoneList;
                for (var d = 0; d < e.data.stoneList.length; d++) {
                  var u = i.stoneListArr[d];
                  0 == d
                    ? ((i.label_fjtf_one.text = u.lvl + "级" + u.name),
                      (i.stone_item1Id = u.id))
                    : 1 == d
                    ? ((i.label_fjtf_two.text = u.lvl + "级" + u.name),
                      (i.stone_item2Id = u.id))
                    : 2 == d &&
                      ((i.label_fjtf_three.text = u.lvl + "级" + u.name),
                      (i.stone_item3Id = u.id));
                }
              }
            }
          },
        }),
        (i.onLoadFuJiangChuZhanOperationDataFn = {
          caller: i,
          code: 2072,
          method: function (e) {
            0 == e.code
              ? i.isOpen &&
                WebSocketService.send({ c: 1009, d: { id: i.suboardID } })
              : ToastView.toastView(e.msg);
          },
        }),
        (i.name = "AXSuboardinateDetailView"),
        Laya.stage.on("AXSuboardinateDetailView", i, i.eventHandler),
        i.btn_subdetail_back.on(Laya.Event.CLICK, i, i.onSubdetailActionFn),
        WebSocketService.addListener(i.onLoadSuboardinateDetailDataFn, !0),
        WebSocketService.addListener(i.onLoadFuJiangChuZhanOperationDataFn),
        i.btn_zhuanzhi.on(Laya.Event.CLICK, i, i.onZhuanZhiAction),
        i.btn_xiubukangxing.on(Laya.Event.CLICK, i, i.onXiuBuKangXingAction),
        i.btn_shuxingdian.on(Laya.Event.CLICK, i, i.onShuXingDianAction),
        i.btn_yanqing.on(Laya.Event.CLICK, i, i.onYanQingAction),
        i.btn_jiangshang.on(Laya.Event.CLICK, i, i.onJiangShangAction),
        i.btn_xiuxi.on(Laya.Event.CLICK, i, i.onSetPattleAction),
        i.btn_peiyang.on(Laya.Event.CLICK, i, i.onPeiYangAction),
        i.btn_zhandounengli.on(Laya.Event.CLICK, i, i.onZhandouPeiYangAction),
        i.btn_jiegufujiang.on(Laya.Event.CLICK, i, i.onJieGuFuJiangAction),
        i.btn_dengjichongxiu.on(Laya.Event.CLICK, i, i.onDengJiChongXiuAction),
        i.btn_change_career.on(Laya.Event.CLICK, i, i.onChangeCareer),
        i.image_fjzb_one.on(Laya.Event.CLICK, i, i.onDidClickFJZBFn),
        i.image_fjzb_two.on(Laya.Event.CLICK, i, i.onDidClickFJZBFn),
        i.image_fjzb_three.on(Laya.Event.CLICK, i, i.onDidClickFJZBFn),
        i.image_fjtf_one.on(Laya.Event.CLICK, i, i.onHunDanActionClick),
        i.image_fjtf_two.on(Laya.Event.CLICK, i, i.onHunDanActionClick),
        i.image_fjtf_three.on(Laya.Event.CLICK, i, i.onHunDanActionClick),
        i.lable_fjjn_one.on(Laya.Event.CLICK, i, i.onFuJiangJiNengActionClick),
        i.lable_fjjn_two.on(Laya.Event.CLICK, i, i.onFuJiangJiNengActionClick),
        i.lable_fjjn_three.on(
          Laya.Event.CLICK,
          i,
          i.onFuJiangJiNengActionClick
        ),
        i.btn_niubiSkill.on(Laya.Event.CLICK, i, i.onDidJueXingSkillClick),
        WebSocketService.addListener(i.onLoadJieGuFuJiangData, !0),
        WebSocketService.addListener({
          caller: i,
          code: 2007,
          method: i.onLoadJiNengResetDataFn,
        }),
        WebSocketService.addListener({
          caller: i,
          code: 4482,
          method: i.onLoadEquipmentDressedData,
        }),
        i
      );
    }
    return (
      __extends(t, e),
      (t.showSuboardView = function (e) {
        null == this.suboardV && (this.suboardV = new t(e)),
          (this.suboardV.isOpen = !0),
          (this.suboardV.suboardDict = e),
          (this.suboardV.suboardID = e.id);
        var i = e.lvl;
        return (
          (this.suboardV.btn_niubiSkill.visible = !1),
          (this.suboardV.btn_zhuanzhi.visible = !1),
          (this.suboardV.btn_xiubukangxing.visible = !1),
          this.suboardV.initShowEquipmentData(i),
          WebSocketService.send({
            c: 1009,
            d: { id: this.suboardV.suboardID },
          }),
          this.suboardV
        );
      }),
      (t.prototype.onJieGuFuJiangAction = function () {
        var e = this.suboardDict.name;
        NormalDialog.showNormalDialog(
          "您确定要解雇" + e + "此副将吗？",
          this,
          this.okMethodFunction
        );
      }),
      (t.prototype.onDengJiChongXiuAction = function () {
        this.suboardDict.name;
        NormalDialog.showNormalDialog(
          "重修后副将会降为0级并且默契度降为0！\n你确定要重修此副将么？",
          this,
          this.okMethodChongXiuFunction
        );
      }),
      (t.prototype.okMethodFunction = function () {
        WebSocketService.send({ c: 1112, d: { cid: this.suboardID } });
      }),
      (t.prototype.okMethodChongXiuFunction = function () {
        WebSocketService.send({ c: 2007, d: { cid: this.suboardID } });
      }),
      (t.prototype.initShowSkillListData = function () {
        (this.lable_fjjn_one.text = "技能1"),
          (this.lable_fjjn_two.text = "技能2"),
          (this.lable_fjjn_three.text = "技能3");
      }),
      (t.prototype.initShowEquipmentData = function (e) {
        e < 30
          ? ((this.lable_fjzb_one.text = "30级解锁"),
            (this.lable_fjzb_two.text = "60级解锁"),
            (this.lable_fjzb_three.text = "90级解锁"))
          : e >= 30 && e < 60
          ? ((this.lable_fjzb_one.text = "可穿戴"),
            (this.lable_fjzb_two.text = "60级解锁"),
            (this.lable_fjzb_three.text = "90级解锁"),
            (this.image_fjzb_60.skin = ""))
          : e >= 60 && e < 90
          ? ((this.lable_fjzb_one.text = "可穿戴"),
            (this.lable_fjzb_two.text = "可穿戴"),
            (this.lable_fjzb_three.text = "90级解锁"))
          : e >= 90 &&
            ((this.lable_fjzb_one.text = "可穿戴"),
            (this.lable_fjzb_two.text = "可穿戴"),
            (this.lable_fjzb_three.text = "可穿戴")),
          (this.image_fjzb_30.skin = ""),
          (this.label_fjzb_30_lvl.text = ""),
          (this.image_fjzb_60.skin = ""),
          (this.label_fjzb_60_lvl.text = ""),
          (this.image_fjzb_90.skin = ""),
          (this.label_fjzb_90_lvl.text = ""),
          (this.label_fjzb_30_lvl.visible = !1),
          (this.label_fjzb_60_lvl.visible = !1),
          (this.label_fjzb_90_lvl.visible = !1);
      }),
      (t.prototype.dealSuboardStar = function (e) {
        var t = "";
        return e > 0 && (t = " (" + e + "星) "), t;
      }),
      (t.prototype.dealProfessMessage = function (e, t) {
        var i,
          a,
          n = parseInt(e),
          o = parseInt(t);
        return (
          (i = n > 0 ? n + " 转" : ""), (a = o > 0 ? o + " 级" : ""), i + a
        );
      }),
      (t.prototype.dealSpattleAction = function (e) {
        var t = parseInt(e);
        return (
          (this.btn_xiuxi.visible = !0),
          t >= 1
            ? ((this.btn_xiuxi.label = "休息"), "已出战")
            : -1 == t
            ? ((this.btn_xiuxi.visible = !1), "不可出战")
            : 0 == t
            ? ((this.btn_xiuxi.label = "出战"), "可出战")
            : void 0
        );
      }),
      (t.prototype.onShuXingDianAction = function () {
        AXPropertyView.showPropertyView(
          parseInt(this.proepValue),
          2,
          this.subObjJson
        );
      }),
      (t.prototype.onYanQingAction = function () {
        AXDinnerPersonView.showPropertyView(this.subObjJson);
      }),
      (t.prototype.onJiangShangAction = function () {
        var e = this.subObjJson.title;
        AXAwardBeliefView.showPropertyView(this.suboardID, e);
      }),
      (t.prototype.onSetPattleAction = function (e) {
        var t;
        "休息" == e.target.label
          ? (t = 3)
          : "出战" == e.target.label && (t = 4),
          WebSocketService.send({ c: 2072, d: { id: this.suboardID, act: t } });
      }),
      (t.prototype.onZhandouPeiYangAction = function () {
        AXSubordCommonView.showCommonView(this.subObjJson, "zhandoushuoming");
      }),
      (t.prototype.onPeiYangAction = function () {
        AXSubordCommonView.showCommonView(this.subObjJson, "chuzhipeiyang");
      }),
      (t.prototype.onDidClickFJZBFn = function (e) {
        if ("item6" == e.target.name) {
          if ("30级解锁" == this.lable_fjzb_one.text) return;
          if ("可穿戴" == this.lable_fjzb_one.text) {
            i = {
              eq_id: "",
              eq_uid: (t = this.suboardID),
              eq_type: "",
              seat: "1",
              preClass: "AXSuboardinateDetailView",
            };
            ArmyEquipmentDialog.showEquipmentView(i);
          } else
            for (a = 0; a < this.armingListArr.length; a++) {
              if (1 == (n = this.armingListArr[a]).i) {
                var t = this.suboardID,
                  i = {
                    eq_id: n.id,
                    eq_uid: t,
                    eq_type: "",
                    seat: "1",
                    preClass: "AXSuboardinateDetailView",
                  };
                ArmyEquipmentDialog.showEquipmentView(i);
                break;
              }
            }
        } else if ("item7" == e.target.name) {
          if ("60级解锁" == this.lable_fjzb_two.text) return;
          if ("可穿戴" == this.lable_fjzb_two.text) {
            i = {
              eq_id: "",
              eq_uid: (t = this.suboardID),
              eq_type: "",
              seat: "2",
              preClass: "AXSuboardinateDetailView",
            };
            ArmyEquipmentDialog.showEquipmentView(i);
          } else
            for (a = 0; a < this.armingListArr.length; a++) {
              if (2 == (n = this.armingListArr[a]).i) {
                var t = this.suboardID,
                  i = {
                    eq_id: n.id,
                    eq_uid: t,
                    eq_type: "",
                    seat: "2",
                    preClass: "AXSuboardinateDetailView",
                  };
                ArmyEquipmentDialog.showEquipmentView(i);
                break;
              }
            }
        } else if ("item8" == e.target.name) {
          if ("90级解锁" == this.lable_fjzb_three.text) return;
          if ("可穿戴" == this.lable_fjzb_three.text) {
            i = {
              eq_id: "",
              eq_uid: (t = this.suboardID),
              eq_type: "",
              seat: "3",
              preClass: "AXSuboardinateDetailView",
            };
            ArmyEquipmentDialog.showEquipmentView(i);
          } else
            for (var a = 0; a < this.armingListArr.length; a++) {
              var n = this.armingListArr[a];
              if (3 == n.i) {
                var t = this.suboardID,
                  i = {
                    eq_id: n.id,
                    eq_uid: t,
                    eq_type: "",
                    seat: "3",
                    preClass: "AXSuboardinateDetailView",
                  };
                ArmyEquipmentDialog.showEquipmentView(i);
                break;
              }
            }
        }
      }),
      (t.prototype.onLoadJiNengResetDataFn = function (e) {
        0 == e.code
          ? (WebSocketService.send({ c: 1009, d: { id: this.suboardID } }),
            WebSocketService.send({ c: 1119, d: null }))
          : ToastView.toastView(e.msg);
      }),
      (t.prototype.onLoadEquipmentDressedData = function (e) {
        0 != e.code ||
          (ToastView.toastView("操作装备成功"),
          WebSocketService.send({ c: 1009, d: { id: this.suboardID } }),
          UnloadEquipmentView.close());
      }),
      (t.prototype.onHunDanActionClick = function (e) {
        var t = e.target.name;
        "item3" == t
          ? this.stone_item1Id
            ? HunDanWearDialog.showHunDanDialog({
                id: this.stone_item1Id,
                cid: this.suboardID,
                sid: this.stone_item1Id,
                controller: "AXSuboardinateDetailView",
              })
            : HunDanWearDialog.showHunDanDialog({
                id: "",
                cid: this.suboardID,
                sid: "",
                controller: "AXSuboardinateDetailView",
              })
          : "item4" == t
          ? this.stone_item2Id
            ? HunDanWearDialog.showHunDanDialog({
                id: this.stone_item2Id,
                cid: this.suboardID,
                sid: this.stone_item1Id,
                controller: "AXSuboardinateDetailView",
              })
            : HunDanWearDialog.showHunDanDialog({
                id: "",
                cid: this.suboardID,
                sid: "",
                controller: "AXSuboardinateDetailView",
              })
          : "item5" == t &&
            (this.stone_item3Id
              ? HunDanWearDialog.showHunDanDialog({
                  id: this.stone_item3Id,
                  cid: this.suboardID,
                  sid: this.stone_item1Id,
                  controller: "AXSuboardinateDetailView",
                })
              : HunDanWearDialog.showHunDanDialog({
                  id: "",
                  cid: this.suboardID,
                  sid: "",
                  controller: "AXSuboardinateDetailView",
                }));
      }),
      (t.prototype.checkFuJiangHaveZhuanZhi = function () {
        return this.subObjJson.roleType > 10 && this.subObjJson.roleType < 100
          ? "1"
          : this.subObjJson.roleType > 100
          ? "2"
          : "0";
      }),
      (t.prototype.onFuJiangJiNengActionClick = function (e) {
        var t = this.checkFuJiangHaveZhuanZhi();
        if ("item_fjjn_lab1" == e.target.name) {
          if (
            (i = this.lable_fjjn_one.text).length > 0 &&
            -1 == i.indexOf("技能")
          ) {
            n = {
              id: (a = this.skillListArr[0]).id,
              name: a.name,
              cid: this.suboardID,
              roleType: this.subObjJson.roleType,
            };
            LookSkillDialog.showLookSkillDialog(n, "AXSuboardinateDetailView");
          } else {
            n = {
              id: "",
              name: "",
              cid: this.suboardID,
              roleType: this.subObjJson.roleType,
            };
            LookSkillDialog.showLookSkillDialog(n, "AXSuboardinateDetailView");
          }
        } else if ("item_fjjn_lab2" == e.target.name) {
          if (
            (i = this.lable_fjjn_two.text).length > 0 &&
            -1 == i.indexOf("技能")
          ) {
            n = {
              id: (a = this.skillListArr[1]).id,
              name: a.name,
              cid: this.suboardID,
              roleType: this.subObjJson.roleType,
            };
            LookSkillDialog.showLookSkillDialog(n, "AXSuboardinateDetailView");
          } else if ("1" == t) {
            n = {
              id: "",
              name: "",
              cid: this.suboardID,
              roleType: this.subObjJson.roleType,
            };
            LookSkillDialog.showLookSkillDialog(n, "AXSuboardinateDetailView");
          }
        } else if ("item_fjjn_lab3" == e.target.name) {
          var i = this.lable_fjjn_three.text;
          if (i.length > 0 && -1 == i.indexOf("技能")) {
            var a = this.skillListArr[2],
              n = {
                id: a.id,
                name: a.name,
                cid: this.suboardID,
                roleType: this.subObjJson.roleType,
              };
            LookSkillDialog.showLookSkillDialog(n, "AXSuboardinateDetailView");
          } else if ("2" == t) {
            n = {
              id: "",
              name: "",
              cid: this.suboardID,
              roleType: this.subObjJson.roleType,
            };
            LookSkillDialog.showLookSkillDialog(n, "AXSuboardinateDetailView");
          }
        }
      }),
      (t.prototype.dealGradeOrHuaString = function (e) {
        return e.hua >= 1
          ? "\n化境Lv" + e.grade + "\n(" + e.useCount + "熟)"
          : "\n" + e.grade + "级\n(" + e.useCount + "熟)";
      }),
      (t.prototype.onDidJueXingSkillClick = function () {
        var e = { name: this.suboardDict.name, id: this.suboardDict.id },
          t = JueXingMainController.showJueXingMainView(e);
        (t.y = 35), Laya.stage.addChild(t);
      }),
      (t.prototype.onZhuanZhiAction = function () {
        var e = { id: this.suboardID };
        ZhuanZhiDialog.showZhuanZhiDialog(e);
      }),
      (t.prototype.onXiuBuKangXingAction = function () {
        var e = {
            name:
              Utils.dealTransAndLvl(
                this.suboardDict.roleType,
                this.suboardDict.lvl
              ) + this.suboardDict.name,
            id: this.suboardID,
            type: "fujiang",
          },
          t = RepairPropertyView.showRepairPropertyView(e);
        (t.y = 35), Laya.stage.addChild(t);
      }),
      (t.prototype.onChangeCareer = function () {
        ChangeOccupationDialog.showChangeOccputionDialog(this.suboardDict);
      }),
      (t.prototype.eventHandler = function (e) {
        console.log(e),
          e &&
            "update_Suboardinate" == e &&
            WebSocketService.send({ c: 1009, d: { id: this.suboardID } });
      }),
      (t.prototype.onSubdetailActionFn = function () {
        (this.isOpen = !1), this.removeSelf();
      }),
      t
    );
  })(ui.SuboardinateController.AXSuboardinateDetailViewUI);
